﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using xiaodingmarket_Domain_core.Models;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using static xiaodingmarket_Domain.Models.EunmType;

namespace xiaodingmarket_Domain.Models
{
    public class CommodityDetail:Entity
    {
        public CommodityDetail()
        {

        }
        public CommodityDetail(Guid id,Guid commodityId, string detile, string title, string thumbnail, string img, decimal price, DateTime logTime, DateTime modifyTime, Guid studentId, Guid modifyId, Address adress)
        {
            Id = id;
            CommodityId = commodityId;
            Detile = detile;
            Title = title;
            Thumbnail = thumbnail;
            Img = img;
            Price = price;
            LogTime = logTime;
            ModifyTime = modifyTime;
            StudentId = studentId;
            ModifyId = modifyId;
            //this.adress = adress;
        }

        /// <summary>
        /// 商品id
        /// </summary>
        public Guid CommodityId { get; private set; }
        /// <summary>
        /// 商品详情
        /// </summary>
        [Column(TypeName = "varchar(500)")]
        public string Detile { get; set; }
        /// <summary>
        /// 商品标题
        /// </summary>
        [Required]
        [Column(TypeName = "varchar(200)")]
        public string Title { get; set; }
        /// <summary>
        /// 商品缩略图地址
        /// </summary>
        [Column(TypeName = "varchar(500)")]
        public string Thumbnail { get; set; }
        /// <summary>
        /// 商品原图地址(设为最大)
        /// </summary>
        public string Img { get; set; }
        /// <summary>
        /// 商品价格
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal Price { get; set; }
        
        /// <summary>
        /// 商品发布时间
        /// </summary>
        [Required]
        public DateTime LogTime { get; set; }
        /// <summary>
        /// 商品最后一次修改时间
        /// </summary>
        [Required]
        public DateTime ModifyTime { get; set; }
        
        /// <summary>
        /// 发布人id
        /// </summary>
        public Guid StudentId { get; set; }
        /// <summary>
        /// 修改人id(用来存放最终审核人信息（因为举报功能可能会有多次审核）)
        /// </summary>
        public Guid ModifyId{ get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        //public Address adress { get; set; }


        public Commodity commodity { get; set; }
    }
}
